home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_8.lha
/
7_8
/
7_8a3.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-08
|
1KB
|
49 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
define gdlistdeclare(TYPE) \
/* manage a doubly-linked list */ \
class gdlist(TYPE) \
{ \
gdlink(TYPE) *last; \
gdlink(TYPE) *curr; \
\
public: \
gdlist(TYPE)() { last = curr = 0; }; \
\
gdlist(TYPE)(TYPE a) \
{ curr = 0; last = new gdlink(TYPE)(a); \
last->next = last->prev = last; \
} \
\
int isempty() { return last != 0; } \
\
void clear(); \
\
~gdlist(TYPE)() { clear(); }; \
\
/* set current pointer to the */ \
/* ends of the list */ \
void reset() { curr = 0; } \
\
/* move around the list, */ \
/* leaving the links there */ \
int next(TYPE &e); \
int prev(TYPE &e); \
\
/* move around the list, */ \
/* removing the links */ \
int getnext(TYPE &e); \
int getprev(TYPE &e); \
\
/* manipulate around the beginning */ \
/* and end of the list */ \
void insert(TYPE e); \
void append(TYPE e); \
\
/* work around the current entry */ \
void inserthere(TYPE e); \
void appendhere(TYPE e); \
};